<h1>Einkauflist anlegen</h1>
<div class="addFormContainer" id="addArticle">
    <form action="./index.php?fnc=purchase&purchaseId=<?php echo $this->getTplVar('nextPurchaseId'); ?>" method="post">
        <label>Käufer(in):</label>
        <select name="user_id">
                <?php
                    $userList = $this->getTplVar('userList');
                    if (is_array($userList)){
                        foreach ($userList AS $user){
                           echo  '<option value="'.$user['id'].'">'.$user['name'].'</option>';
                        }
                    }
                ?>
        </select>
        <br />
        <label>Kommentar</label><input type="text" name="comment" />
        <!--label>Kommentar</label><textarea name="comment" cols="50" rows="3"></textarea-->
        <br />
        <br />
        <br />
        <input type="hidden" name="action" value="add" />
        <!--input type="hidden" name="purchaseId" value="<?php echo $this->getTplVar('nextPurchaseId'); ?>" /-->
        <label></label><input value="Anlegen" type="submit" />
    </form>
</div>

<h1>List</h1>
<div class="editFormContainer" id="editPurchase">
    <form action="./index.php?fnc=purchase" method="post">

        <?php
        $length1 = 10;
        $length2 = 25;
        $length3 = 18;
        $length4 = 20;
        ?>

        <table class="purchaseList">
            <tbody>
            <tr>
                <td width="<?php echo $length1; ?>%" valign="top">
                    <div>&nbsp;</div>
                </td>
                <td width="<?php echo $length4; ?>%" valign="top">
                    <div><strong>Zeit</strong></div>
                </td>
                <td width="<?php echo $length3; ?>%" valign="top">
                    <div><strong>Accout</strong></div>
                </td>
                <td width="<?php echo $length4; ?>%" valign="top">
                    <div><strong>Betrag(Euro)</strong></div>
                </td>
                <td width="<?php echo $length2; ?>%" valign="top">
                    <div><strong>Kommentar</strong></div>
                </td>
                <td width="<?php echo $length3; ?>%" valign="top">
                    <div><strong>Zustand</strong></div>
                </td>
                <td width="<?php echo $length2; ?>%" valign="top">
                    <div><strong>Eingangszeit</strong></div>
                </td>
            </tr>
            <?php
            $list = $this->getTplVar('list');
            if (is_array($list) && count($list) > 0){
                foreach ($list AS $purchase){

                    $aim = '';
                    $linkStart = '<a href="./index.php?fnc=purchase&purchaseId='.$purchase['id'].'" >';
                    $linkEnd = '</a>';

                    echo '<tr>';
                    //check box <label for="'.$article['id'].'" class="selectBoxLabel">'.$article['name_de'].'</label></b>
                    echo '<td width="'.$length1.'%" valign="top"><div class="column"><input type="checkbox" name="purchaseId[]" class="selectBox"  value="'.$purchase['id'].'" id="'.$purchase['id'].'"></div></td>';
                    echo '<td width="'.$length4.'%" valign="top"><div class="column">'.$linkStart.$purchase['create_time'].$linkEnd.'</div></td>';
                    echo '<td width="'.$length3.'%" valign="top"><div class="column">'.$purchase['user_id'].'</div></td>';
                    echo '<td width="'.$length4.'%" valign="top"><div class="column">'.$purchase['total_price_e'].'</div></td>';
                    echo '<td width="'.$length2.'%" valign="top"><div class="column">'.$purchase['comment'].'</div></td>';
                    echo '<td width="'.$length3.'%" valign="top"><div class="column">'.$purchase['status'].'</div></td>';
                    $lastChangeTime = '---';
                    if ($purchase['last_change_time'] != $purchase['create_time']){
                        $lastChangeTime = $purchase['last_change_time'];
                    }



                    echo '<td width="'.$length2.'%" valign="top"><div class="column">'.$lastChangeTime.'</div></td>';

                    echo '</tr>';
                }
            }

            ?>
            </tbody>
        </table>

        <input type="submit" name="action" value="Löschen"/>
        <input type="submit" name="action" value="Einlagern" />
        <input type="submit" name="action" value="Auslagern" />

        <!---

        <table cellpadding="0" cellspacing="0" class="btm-blk"><tbody><tr><td width="25px;"><input type="checkbox" value="BulkCheckAction" name="BkCkBm" id="BkCkBm240"><label class="g-hdn" for="BkCkBm240">Alle markieren</label></td><td><div class="BottomBulk"><b id="v4-My_38_24" class="bn-w bn-m bn-pad trsb-S"><i>Notiz hinzufügen</i><span id="spn_v4-My_38_24" class="bn-b trsb-b trsb-S"><input id="but_v4-My_38_24" name="BulkAddNote" value="Notiz hinzufügen" title="" type="button"><b id="txt_v4-My_38_24">Notiz hinzufügen</b></span></b><b id="v4-My_38_25" class="bn-w bn-m bn-pad trsb-S"><i>Löschen</i><span id="spn_v4-My_38_25" class="bn-b trsb-b trsb-S"><input id="but_v4-My_38_25" name="SubmitAction.BulkDelete" value="Löschen" title="" type="button"><b id="txt_v4-My_38_25">Löschen</b></span></b><b id="v4-My_38_26" class="bn-w bn-m bn-pad trsb-S"><i>Vergleichen</i><span id="spn_v4-My_38_26" class="bn-b trsb-b trsb-S"><input id="but_v4-My_38_26" name="SubmitAction.BulkCompare" value="Vergleichen" title="" type="submit"><b id="txt_v4-My_38_26">Vergleichen</b></span></b><input type="hidden" name="coaction" value="compare"><b id="v4-My_38_27" class="bn-w bn-m bn-pad trsb-S"><i>Auf die Liste</i><span id="spn_v4-My_38_27" class="bn-b trsb-b trsb-S"><input id="but_v4-My_38_27" name="Artikel zu Liste(n) hinzufügen" value="Auf die Liste" title="" type="button"><b id="txt_v4-My_38_27">Auf die Liste</b></span></b></div></td></tr></tbody></table>

         --->
    </form>

</div>